﻿<Window x:Class="LegoBotPrimaUI.MainPrimaWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Main Window" Height="530" Width="530"
        Name="self">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="1*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="30" />
            <RowDefinition Height="1*" />
        </Grid.RowDefinitions>

        <Button x:Name="StartAutonomousButton" Content="Start Autonomous" Margin="4" IsEnabled="False" Grid.Column="0" Grid.Row="0" Click="StartAutonomousButton_Click" />
        <Button x:Name="StartManualButton" Content="Start Manual" Margin="4" IsEnabled="False" Grid.Column="1" Grid.Row="0" Click="StartManualButton_Click" />
        <Button x:Name="StopButton" Content="Stop" Margin="4" Grid.Column="2" Grid.Row="0" IsEnabled="False" Click="StopButton_Click" />

        <Button x:Name="ForwardButton" Content="Forward" Margin="4" Grid.Column="1" Grid.Row="2" IsEnabled="False"  PreviewMouseDown="ForwardButton_MouseDown" PreviewMouseUp="StopMovement" />
        <Button x:Name="LeftButton" Content="Left" Margin="4" Grid.Column="0" Grid.Row="3" IsEnabled="False" PreviewMouseDown="LeftButton_MouseDown" PreviewMouseUp="StopMovement" />
        <Button x:Name="RightButton" Content="Right" Margin="4" Grid.Column="2" Grid.Row="3" IsEnabled="False" PreviewMouseDown="RightButton_MouseDown" PreviewMouseUp="StopMovement" />
        <Button x:Name="BackwardButton" Content="Backward" Margin="4" Grid.Column="1" Grid.Row="4" IsEnabled="False" PreviewMouseDown="BackwardButton_MouseDown" PreviewMouseUp="StopMovement" />
        <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="1">
            <Label Content="Ultrasonic:" Grid.Row="1" Height="28" Width="70" HorizontalAlignment="Left" VerticalAlignment="Top" />
            <TextBox x:Name="UltrasonicText" IsReadOnly="True" Width="80" FontSize="16" />
        </StackPanel>
        <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1">
            <Label Content="Compass:" Grid.Row="1" Height="28" Width="68" HorizontalAlignment="Left" VerticalAlignment="Top" />
            <TextBox x:Name="CompassText" IsReadOnly="True" Width="80" FontSize="16" />
        </StackPanel>
        <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="1">
            <Label Content="Bumper:" Grid.Row="1" Height="28" Width="68" HorizontalAlignment="Left" VerticalAlignment="Top" />
            <TextBox x:Name="BumperText" IsReadOnly="True" Width="80" />
        </StackPanel>
        <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="2">
            <Label Content="Bot Action:" Grid.Row="1" Width="70" Height="28" HorizontalAlignment="Left" VerticalAlignment="Top" />
            <TextBox x:Name="BotActionText" IsReadOnly="True" Width="80" FontSize="16" />
        </StackPanel>

        <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="3">
            <ComboBox x:Name="BotActionsList" Width="160" Margin="3" SelectedIndex="0" IsEnabled="False" SelectionChanged="BotActionsList_SelectionChanged">
                <ComboBoxItem Tag="LegoBotPrima.Actions.StopBotAction, LegoBotPrimaService.Y2010.M06">Stop</ComboBoxItem>
                <ComboBoxItem Tag="LegoBotPrima.Actions.ForwardBotAction, LegoBotPrimaService.Y2010.M06">Forward</ComboBoxItem>
                <ComboBoxItem Tag="LegoBotPrima.Actions.LeftBotAction, LegoBotPrimaService.Y2010.M06">Left</ComboBoxItem>
                <ComboBoxItem Tag="LegoBotPrima.Actions.RightBotAction, LegoBotPrimaService.Y2010.M06">Right</ComboBoxItem>
                <ComboBoxItem Tag="LegoBotPrima.Actions.BackwardBotAction, LegoBotPrimaService.Y2010.M06">Backward</ComboBoxItem>
                <ComboBoxItem Tag="LegoBotPrima.Actions.Rotate360BotAction, LegoBotPrimaService.Y2010.M06">Rotate 360</ComboBoxItem>
                <ComboBoxItem Tag="LegoBotPrima.Actions.StepBackBotAction, LegoBotPrimaService.Y2010.M06">Step Back</ComboBoxItem>
                <ComboBoxItem Tag="LegoBotPrima.Actions.GoToAngleBotAction, LegoBotPrimaService.Y2010.M06">Go To Angle 0 degrees</ComboBoxItem>
            </ComboBox>
        </StackPanel>
        <Canvas x:Name="Map" Background="LightGray" Width="510" Height="340" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3">
            <Canvas.Clip>
                <PathGeometry Figures=" M 0,0 L 0,340 L 510,340 L 510,0 Z" />
            </Canvas.Clip>
            
            <Canvas x:Name="LinesCanvas" />

            <Canvas x:Name="BotCanvas" Canvas.Left="250" Canvas.Top="160">
                <Polygon x:Name="BotOnMap" Points="5,0 0,20 10,20" Canvas.Left="-5" Canvas.Top="0" Stroke="Black" Fill="Yellow"/>
                <Ellipse x:Name="Bumper" Fill="Red" Canvas.Left="-5" Canvas.Top="-2" Height="10" Width="10" Visibility="Collapsed" />
                <Polygon x:Name="Distance" Points="0,0 40,0 20,20" Canvas.Left="-20" Canvas.Top="-20" Stroke="Transparent">
                    <Polygon.Fill>
                        <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                            <LinearGradientBrush.GradientStops>
                                <GradientStop Offset="0" Color="Red"/>
                                <GradientStop Offset="1" Color="Transparent"/>
                            </LinearGradientBrush.GradientStops>
                        </LinearGradientBrush>
                    </Polygon.Fill>
                </Polygon>
            </Canvas>

        </Canvas>
    </Grid>
</Window>
